package com.sirius.meta.mall.bus.jdk8.lambda;

import com.sirius.meta.mall.bus.jdk8.swagger.model.User;

import java.util.ArrayList;

/**
 * @author Surging
 * @version 1.0
 * @ClassName CollectionTest
 * @date 2022/1/17 20:44
 * @desc
 */
public class CollectionTest {

    public static void main(String[] args) {
        ArrayList<String> strings = new ArrayList<>();
        strings.add("a");
        strings.add("b");
        strings.add("c");
        strings.forEach((String i)-> System.out.println(i));
        ArrayList<User> users = new ArrayList<>();
        users.add(new User("fxd", 18));
        users.add(new User("cp", 19));
        users.add(new User("xfn", 20));
        users.add(new User("zzq", 19));
        users.sort((o1, o2) -> {
            return o1.getAge() - o2.getAge();
        });
        users.forEach((User i)-> System.out.println(i.toString()));

    }

}
